$(function(){  
    $('.calendar_enabled').live("click", function(){
        var menu =  $(this);
        $('.popup').remove();
        $.post(base_url+"source/ajax.php?action=load_menu", {
            date: menu.attr('id')
        }, function(data){
            menu.after(data);
        });
            
    });
    $('.addmenu').live("click",function(){
        var menudate = $('#date').val();
        var fc = $('#menu_fc').val();
        var mc = $('#menu_mc').val();
        if($('#menu_disable').attr("checked")){
            var disabled = 1;
        } else{
            var disabled = 0;
        }
            
        
        $.post(base_url+"source/ajax.php?action=update_menu", {
            date: menudate,
            fc: fc,
            mc: mc,
            disabled: disabled
        });
        $(this).closest('.day_menu').remove();
    });
});